package com.spring.annotation;

import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.util.ClassUtils;

import java.beans.Introspector;
import java.util.Map;
import java.util.Set;

/**
 * Created by wangyg on 2017/1/5.
 * 该类需要包含一个无参构造方法，因为spring中具体对于其实例化为通过ComponentScanBeanDefinitionParser
 * 类中的方法实现，该方法中使用NewInstance()创建实例.
 */
public class BaseBeanNameGenerator extends AnnotationBeanNameGenerator implements BeanNameGenerator {
	//private String a;
	//
	//	public BaseBeanNameGenerator(String a) {
	//		this.a = a;
	//	}

	@Override
	public String buildDefaultBeanName(BeanDefinition definition) {
		return definition.getBeanClassName();
	}

}
